/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sp.form;

import java.util.ArrayList;
import javax.swing.JLayeredPane;
import sp.component.TextAreaCatatan;
import sp.component.TextField;
import sp.model.B1;
import sp.model.B5;
import sp.model.Sisipan;
import sp.util.FormControl;

/**
 *
 * @author Rohma Hidayati [12.7363]
 */
public final class Hal7 extends javax.swing.JPanel {

    /**
     * Creates new form Hal7
     */
    protected static int startPos = Hal1.maxPos + Hal2.maxPos + Hal3.maxPos + Hal4.maxPos + Hal5.maxPos + Hal6.maxPos;
    protected static int maxPos;
    
    private ArrayList<TextField> listTextFieldHal7 = new ArrayList<TextField>();
    
    public Hal7() {
        initComponents();
        addListTextfield();
        setListTextFieldHal7(FormControl.setFixedPos(startPos, getListTextField()));
        FormControl.setTextArea(textAreaCatatan1);
    }
    
    public ArrayList<TextField> getListTextField() {
        return listTextFieldHal7;
    }
    
    public int getMaxPertanyaan() {
        return maxPos;
    }
    
    private void addListTextfield() {
        getListTextField().add(0, jamMulai);
        getListTextField().add(1, menitMulai);
        getListTextField().add(2, jamSelesai);
        getListTextField().add(3, menitSelesai);
        getListTextField().add(4, durasi);
        getListTextField().add(5, pertanyaan1a);
        getListTextField().add(6, pertanyaan1b);
        getListTextField().add(7, pertanyaan2);
        getListTextField().add(8, pertanyaan3a);
        getListTextField().add(9, pertanyaan3b);
        maxPos = getListTextField().size();
    }
    
    public void setFieldHal7(B1 b1, B5 b5, Sisipan ssp) {
        try {
            durasi.setText(b1.getTimestamp());
            pertanyaan1a.setText(ssp.getKlasifikasi().getKode());
            if (pertanyaan1a.getText().equals("2")) {
                pertanyaan1b.setEnabled(false);
            } else {
                pertanyaan1b.setEnabled(true);
            }
            pertanyaan1b.setText(ssp.getPertanyaan1());
            pertanyaan2.setText(ssp.getPertanyaan2().getKode());
            if (pertanyaan2.getText().equals("2")) {
                pertanyaan3b.setEnabled(false);
                pertanyaan3a.setEnabled(false);
            } else {
                pertanyaan3a.setEnabled(true);
                pertanyaan3b.setEnabled(true);
            }            
            pertanyaan3a.setText(ssp.getPertanyaan3a().getKode());
            if (!pertanyaan3a.getText().equals("5")) {
                pertanyaan3b.setEnabled(false);
            } else {
                pertanyaan3b.setEnabled(true);
            }
            pertanyaan3b.setText(ssp.getPertanyaan3b());
            textAreaCatatan1.setText(b5.getCatatan());
        } catch (Exception e) {
            
        }
    }
    
    public void setFromListing(){
        for (int i = 0; i < getListTextFieldHal7().size(); i++) {
            getListTextFieldHal7().get(i).setEnabled(true);
        }
    }
    
    public static int getStartPos() {
        return startPos;
    }
    
    public static void setStartPos(int startPos) {
        Hal7.startPos = startPos;
    }
    
    public static int getMaxPos() {
        return maxPos;
    }
    
    public static void setMaxPos(int maxPos) {
        Hal7.maxPos = maxPos;
    }
    
    public ArrayList<TextField> getListTextFieldHal7() {
        return listTextFieldHal7;
    }
    
    public void setListTextFieldHal7(ArrayList<TextField> listTextFieldHal7) {
        this.listTextFieldHal7 = listTextFieldHal7;
    }
    
    public TextField getDurasi() {
        return durasi;
    }
    
    public void setDurasi(TextField durasi) {
        this.durasi = durasi;
    }
    
    public sp.imageClass.Hal7 getHal71() {
        return hal71;
    }
    
    public void setHal71(sp.imageClass.Hal7 hal71) {
        this.hal71 = hal71;
    }
    
    public JLayeredPane getjLayeredPane1() {
        return jLayeredPane1;
    }
    
    public void setjLayeredPane1(JLayeredPane jLayeredPane1) {
        this.jLayeredPane1 = jLayeredPane1;
    }
    
    public TextField getJamMulai() {
        return jamMulai;
    }
    
    public void setJamMulai(TextField jamMulai) {
        this.jamMulai = jamMulai;
    }
    
    public TextField getJamSelesai() {
        return jamSelesai;
    }
    
    public void setJamSelesai(TextField jamSelesai) {
        this.jamSelesai = jamSelesai;
    }
    
    public TextField getMenitMulai() {
        return menitMulai;
    }
    
    public TextAreaCatatan getTextAreaCatatan1() {
        return textAreaCatatan1;
    }
    
    public void setTextAreaCatatan1(TextAreaCatatan textAreaCatatan1) {
        this.textAreaCatatan1 = textAreaCatatan1;
    }
    
    public void setMenitMulai(TextField menitMulai) {
        this.menitMulai = menitMulai;
    }
    
    public TextField getMenitSelesai() {
        return menitSelesai;
    }
    
    public void setMenitSelesai(TextField menitSelesai) {
        this.menitSelesai = menitSelesai;
    }
    
    public TextField getPertanyaan1a() {
        return pertanyaan1a;
    }
    
    public void setPertanyaan1a(TextField pertanyaan1a) {
        this.pertanyaan1a = pertanyaan1a;
    }
    
    public TextField getPertanyaan1b() {
        return pertanyaan1b;
    }
    
    public void setPertanyaan1b(TextField pertanyaan1b) {
        this.pertanyaan1b = pertanyaan1b;
    }
    
    public TextField getPertanyaan2() {
        return pertanyaan2;
    }
    
    public void setPertanyaan2(TextField pertanyaan2) {
        this.pertanyaan2 = pertanyaan2;
    }
    
    public TextField getPertanyaan3a() {
        return pertanyaan3a;
    }
    
    public void setPertanyaan3a(TextField pertanyaan3a) {
        this.pertanyaan3a = pertanyaan3a;
    }
    
    public TextField getPertanyaan3b() {
        return pertanyaan3b;
    }
    
    public void setPertanyaan3b(TextField pertanyaan3b) {
        this.pertanyaan3b = pertanyaan3b;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        hal71 = new sp.imageClass.Hal7();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jamMulai = new sp.component.TextField();
        menitMulai = new sp.component.TextField();
        jamSelesai = new sp.component.TextField();
        menitSelesai = new sp.component.TextField();
        durasi = new sp.component.TextField();
        pertanyaan1a = new sp.component.TextField();
        pertanyaan1b = new sp.component.TextField();
        pertanyaan2 = new sp.component.TextField();
        pertanyaan3a = new sp.component.TextField();
        pertanyaan3b = new sp.component.TextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        textAreaCatatan1 = new sp.component.TextAreaCatatan();

        setAutoscrolls(true);
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        setLayout(new java.awt.BorderLayout());

        jLayeredPane1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel1.setText("Waktu Mulai      :");
        jLayeredPane1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 60, -1, -1));

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel2.setText("Waktu Selesai    :");
        jLayeredPane1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 100, -1, -1));

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel3.setText("CATATAN");
        jLayeredPane1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 520, -1, -1));

        jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jLabel4.setText("1. Apa yang anda ketahui tentang revolusi mental? (jawab secara singkat)");
        jLayeredPane1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 180, -1, -1));

        jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jLabel5.setText("<html>2. Apakah anda mengetahui tentang adanya <b>program revolusi mental</b> dari pemerintahan sekarang?</html>");
        jLayeredPane1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 300, -1, -1));

        jLabel6.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jLabel6.setText("1. Mengetahui                       2. Tidak mengetahui");
        jLayeredPane1.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 210, -1, -1));

        jLabel7.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jLabel7.setText("3. Jika ya, menurut anda, sasaran utama dari program revolusi mental adalah");
        jLayeredPane1.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 360, -1, -1));

        jLabel8.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jLabel8.setText("1. Birokrasi");
        jLayeredPane1.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 380, -1, -1));

        jLabel9.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jLabel9.setText("2. Swasta/BUMN/Pelaku usaha");
        jLayeredPane1.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 400, -1, -1));

        jLabel10.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jLabel10.setText("3. Masyarakat sipil");
        jLayeredPane1.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 420, -1, -1));

        jLabel11.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jLabel11.setText("4. Angkatan kerja muda");
        jLayeredPane1.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 440, -1, -1));

        jLabel12.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jLabel12.setText("5. Lainnya :");
        jLayeredPane1.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 470, -1, -1));

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel13.setText("jam");
        jLayeredPane1.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 100, -1, -1));

        jLabel14.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel14.setText("jam");
        jLayeredPane1.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 60, -1, -1));

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel15.setText("menit");
        jLayeredPane1.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 80, -1, -1));

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel16.setText("menit");
        jLayeredPane1.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 60, -1, -1));

        jLabel17.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel17.setText("PERTANYAAN SISIPAN");
        jLayeredPane1.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 150, -1, -1));

        jLabel18.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel18.setText("Durasi    :");
        jLayeredPane1.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 80, -1, -1));

        jLabel19.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        jLabel19.setText("1. Ya                       2. Tidak → Stop");
        jLayeredPane1.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 320, -1, -1));

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        jLabel20.setText("menit");
        jLayeredPane1.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 100, -1, -1));

        jamMulai.setAngka(true);
        jamMulai.setLength(2);
        jamMulai.setMaxDigit(24);
        jamMulai.setMinDigit(1);
        jLayeredPane1.add(jamMulai, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 50, 30, 30));

        menitMulai.setAngka(true);
        menitMulai.setLength(2);
        menitMulai.setMaxDigit(59);
        jLayeredPane1.add(menitMulai, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 50, 30, 30));

        jamSelesai.setAngka(true);
        jamSelesai.setLength(2);
        jamSelesai.setMaxDigit(24);
        jamSelesai.setMinDigit(1);
        jLayeredPane1.add(jamSelesai, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 90, 30, 30));

        menitSelesai.setAngka(true);
        menitSelesai.setKhusus(true);
        menitSelesai.setKhususType('4');
        menitSelesai.setLength(2);
        menitSelesai.setMaxDigit(59);
        jLayeredPane1.add(menitSelesai, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 90, 30, 30));

        durasi.setAngka(true);
        durasi.setLength(5);
        durasi.setMaxDigit(999);
        jLayeredPane1.add(durasi, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 70, 120, 30));

        pertanyaan1a.setAngka(true);
        pertanyaan1a.setKhusus(true);
        pertanyaan1a.setKhususType('5');
        pertanyaan1a.setLength(1);
        pertanyaan1a.setMaxDigit(2);
        pertanyaan1a.setMinDigit(1);
        pertanyaan1a.setRequired(true);
        jLayeredPane1.add(pertanyaan1a, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 200, 30, 30));

        pertanyaan1b.setAngka(true);
        pertanyaan1b.setHuruf(true);
        pertanyaan1b.setLength(5000);
        jLayeredPane1.add(pertanyaan1b, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 240, 830, 50));

        pertanyaan2.setAngka(true);
        pertanyaan2.setKhusus(true);
        pertanyaan2.setKhususType('6');
        pertanyaan2.setLength(1);
        pertanyaan2.setMaxDigit(2);
        pertanyaan2.setMinDigit(1);
        pertanyaan2.setRequired(true);
        jLayeredPane1.add(pertanyaan2, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 320, 30, 30));

        pertanyaan3a.setAngka(true);
        pertanyaan3a.setKhusus(true);
        pertanyaan3a.setKhususType('8');
        pertanyaan3a.setLength(1);
        pertanyaan3a.setMaxDigit(5);
        pertanyaan3a.setRequired(true);
        jLayeredPane1.add(pertanyaan3a, new org.netbeans.lib.awtextra.AbsoluteConstraints(840, 410, 30, 30));

        pertanyaan3b.setAngka(true);
        pertanyaan3b.setHuruf(true);
        pertanyaan3b.setLength(300);
        jLayeredPane1.add(pertanyaan3b, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 460, 750, 30));

        textAreaCatatan1.setColumns(20);
        textAreaCatatan1.setRows(5);
        jScrollPane1.setViewportView(textAreaCatatan1);

        jLayeredPane1.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 540, 860, 490));

        javax.swing.GroupLayout hal71Layout = new javax.swing.GroupLayout(hal71);
        hal71.setLayout(hal71Layout);
        hal71Layout.setHorizontalGroup(
            hal71Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1)
        );
        hal71Layout.setVerticalGroup(
            hal71Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1)
        );

        add(hal71, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private sp.component.TextField durasi;
    private sp.imageClass.Hal7 hal71;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JScrollPane jScrollPane1;
    private sp.component.TextField jamMulai;
    private sp.component.TextField jamSelesai;
    private sp.component.TextField menitMulai;
    private sp.component.TextField menitSelesai;
    private sp.component.TextField pertanyaan1a;
    private sp.component.TextField pertanyaan1b;
    private sp.component.TextField pertanyaan2;
    private sp.component.TextField pertanyaan3a;
    private sp.component.TextField pertanyaan3b;
    private sp.component.TextAreaCatatan textAreaCatatan1;
    // End of variables declaration//GEN-END:variables
}
